package com.boot.param;

import java.io.Serializable;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.boot.validate.group.ValidateGroupNameOne;
import com.boot.validate.group.ValidateGroupNameTwo;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

@Data
public class User implements Serializable {

    @NotNull(message = "id不能为空")
    @Length(min = 2, max = 10, message = "id的长度必须在{min}-{max}之间")
    private String id;

    @NotEmpty(groups = { ValidateGroupNameOne.class }, message = "userName不能为空,from group1")
    @NotEmpty(groups = { ValidateGroupNameTwo.class }, message = "userName不能为空,from group2")
    @NotNull(message = "userName不能为空")
    private String userName;

    private int    sex;
}
